package com.nettest.entity.system;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import javax.persistence.TableGenerator;

import org.apache.commons.lang.builder.ToStringStyle;

import com.nettest.entity.BaseAuditable;
@Entity
@Table(name = "t_menu")
public class Menu extends BaseAuditable {

    private static final long serialVersionUID = 8554900844603779994L;

    @TableGenerator(
			name="idGen", 
			table="ID_GENERATOR", 
			pkColumnName="ID_KEY", 
			valueColumnName="ID_VALUE", 
			pkColumnValue="MENU_ID", 
			allocationSize=1)
	@Id
	@GeneratedValue(strategy=GenerationType.TABLE, generator="idGen")
	@Column(name="id")
    private Long id;
    @Column(name="menu_id")
    private String menuId;
    @Column(name="parent_id")
    private String parentId;
    @Column(name="menu_name",length=100)
    private String menuName;
    @Column(name="menu_full_path",length=100)
    private String menuFullPath;
    @Column(name="menu_action",length=100)
    private String menuAction;
    @Column(name="is_leaf")
    @org.hibernate.annotations.Type(type="yes_no")
    private Boolean isLeaf;
    @Column(name="short_cut")
    @org.hibernate.annotations.Type(type="yes_no")
    private Boolean isShortcut = false;
    @ManyToMany(mappedBy="menus")
    private Set<Role> roles = new HashSet<Role>();
   
    public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getMenuId() {
		return menuId;
	}

	public void setMenuId(String menuId) {
		this.menuId = menuId;
	}

	public String getParentId() {
		return parentId;
	}

	public void setParentId(String parentId) {
		this.parentId = parentId;
	}

	public String getMenuName() {
		return menuName;
	}


	public void setMenuName(String menuName) {
		this.menuName = menuName;
	}


	public String getMenuFullPath() {
		return menuFullPath;
	}


	public void setMenuFullPath(String menuFullPath) {
		this.menuFullPath = menuFullPath;
	}


	public String getMenuAction() {
		return menuAction;
	}


	public void setMenuAction(String menuAction) {
		this.menuAction = menuAction;
	}


	public Boolean getIsLeaf() {
		return isLeaf;
	}


	public void setIsLeaf(Boolean isLeaf) {
		this.isLeaf = isLeaf;
	}

	public Set<Role> getRoles() {
		return roles;
	}

	public void setRoles(Set<Role> roles) {
		this.roles = roles;
	}

	public Boolean getIsShortcut() {
		return isShortcut;
	}

	public void setIsShortcut(Boolean isShortcut) {
		this.isShortcut = isShortcut;
	}

	@Override
    public String toString() {
        return org.apache.commons.lang.builder.ReflectionToStringBuilder
                .toString(this, ToStringStyle.MULTI_LINE_STYLE);
    }
}
